In this video, I'm going to introduce climbing to our path, finding something that doesn't happen
by default.
So I made a ladder.
I put it in the resources and I saved it off as an RB file, which you can download to your computer.
Then go to your workspace, right click insert from file, find it wherever you put it on your computer.
So you got to remember simple ladder open and then you have a ladder.
Let's go ahead and move that ladder.
And you can build your own ladder.
Ladders aren't that hard, but if you don't feel like doing it, you just want to learn pathfinding.
You're like, Man, I want to build a ladder.
There's one right here and I'll just move that up against.
So to show that this doesn't happen automatically, this climbing doesn't happen automatically, let's
block him off, hit the scale, turn collisions back off.
She's good and block.
I mean, here now he should fail to compute a path and we have no way of knowing that if we go to our
move NPC script and we look under follow path, you will see the case for a successful path.
But I didn't do anything for failure.
So let's go ahead and do that onto an ls LS and then I'll just do a printout to my console window.
I'll say like bra, no path for me, and then we'll know that the path failed.
Now let's go ahead and try this.
He should get.
He should get a failure view output window.
There it is.
And I will hit the play button.
And bruh no path for me.
He couldn't climb the ladder and he couldn't get out of the box.
So let's get that climbing action in there.
We have this ladder right here and we're going to need two attachments and something called a pathfinding
link to attach to the two attachments.
So I'm going to hit the alt.
Click that bottom step on my ladder, and then I hit the plus on the bot.
Step A for attachment.
Add an attachment.
Now I'm going to move the attachment out a little bit.
Let's go to our home.
Move.
Select the attachment and it does not have to be touching the part that it's parented to.
So I'm going to put it right here.
And now I'm going to go to the top step.
Bam!
And then I do another attachment.
I'm putting it both on on the ladder.
So if I move the ladder around, it's still going to have the link.
So hit the plus A for attachment.
There we go.
And I can move that one.
If I can get there.
There we go.
Grab the attachment.
I'll move it up.
And I want to show that he can actually get to the wall.
That should work.
It doesn't have to be exact.
All right.
Now, on either the top or the bottom step, this will work on either one.
We're going to hit the plus.
We're going to do a PR and we'll look for Pathfinding link.
There we go.
We got the link, but it's not attached to anything.
Luckily on the Pathfinding link, you have these two attachment spots, Attachment zero, Attachment
one.
So let's go to attachment zero and we'll select our top step Attachment one, bottom step attachment.
So I just put the attachments on each of those steps in these slots right here, the properties of my
Pathfinding link.
Now, it doesn't matter which order you do because we're going to use a bidirectional link.
He's not going to climb back down the ladder.
He's just going to jump.
But make sure that you have it.
Bidirectional should be right here.
Here it is.
Bidirectional checked so you don't have to worry about which arrow it is because if it's going down,
he's not going to go up the steps.
All right.
Now we are good to go.
I did a lot of talking, didn't do a lot of coding, but we got our climbing implemented.
Let's check it out.
He's going to go up that ladder.
Sweet.
Oh, look at that.
That's pretty tricky.
He made it all the way around.
That's pretty cool, though.
So we have climbing.
And if you're wondering about swimming, if you put in some water, the pathfinding service will allow
swimming without a special pathfinding link.
But if it doesn't, you could always add one.
And if you really want to get into this, there's something called a pathfinding modifier.
Let's take a quick look.
So if I hit the plus and this pathfinding modifier will allow you to make some paths harder to traverse
than others so there'll be a favoritism toward certain paths.
That's pretty good for AI.
So you should keep that in mind.
All right.
So I will see you in the next video.
Good luck with your pathfinding.